import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SapOrderQuery, SapOrderVO } from '@/api/painting/sapOrder/types';

/**
 * 查询SAP订单管理列表
 * @param query
 * @returns {*}
 */

export const listSapOrder = (query?: SapOrderQuery): AxiosPromise<SapOrderVO[]> => {
  return request({
    url: '/painting/pda/project/list',
    method: 'get',
    params: query
  });
};

/**
 * 绑定标签
 * @param data
 * @returns {*}
 */
export const bindTag = (data: any) => {
  return request({
    url: '/painting/pda/tag/bind',
    method: 'post',
    data
  });
};

/**
 * 查询标签已绑定项目
 * @param tagCode
 * @returns {*}
 */
export const getTagProject = (tagCode: string) => {
  return request({
    url: '/painting/pda/tag/project',
    method: 'get',
    params: { tagCode }
  });
};

/**
 * 解绑标签
 * @param data
 * @returns {*}
 */
export const unbindTag = (data: any) => {
  return request({
    url: '/painting/pda/tag/unbind',
    method: 'post',
    data
  });
};

/**
 * 查询迁车台下拉列表
 * @param tagCode
 * @returns {*}
 */
export const getTractionList = () => {
  return request({
    url: '/painting/pda/tractionList',
    method: 'get'
  });
};
